import { defineComponent, PropType } from 'vue'

export default defineComponent({
  name: 'Iconfont',
  emits: ['click'],
  props: {
    icon: {
      type: String as PropType<string>,
      required: true,
    },
    size: {
      type: String as PropType<string>,
      default: '14',
    },
    color: {
      type: String as PropType<string>,
      default: '#000',
    },
    ariaDescribedby: String,
    tabindex: String,
    mouseenter: Function,
    mouseleave: Function,
    onClick: Function,
    class: String as PropType<string>,
  },
  setup(props, { emit }) {
    const handleClick = (e: any) => {
      emit('click', e)
    }
    return () => (
      <>
        <i
          onClick={handleClick}
          class={['iconfont', props.icon, props?.class, undefined]}
          style={`font-size: ${props.size}px; color: ${props.color};`}
        ></i>
      </>
    )
  },
})
